<!-- 发票管理 -->
<template>
    <div class="page-box h100 display-flex czbj">
        <p class="title-label">模版列表</p>
        <div class="mt10">
            <!-- <dxtable :dataJson="dataJson" :portUrl="portUrl" :qx="qx" ref="databale" :headBtnw="headBtnw"
                :formJson="formJson" sonRouter="addInvoice" bjtext="查看详情" :czFun="czFun" czWidth="240"></dxtable> -->


            <dxtable  ref="databale" :dataJson="dataJson" :portUrl="portUrl" :qx="qx" :formJson="formJson"
                :czFun="czFun" addurl="phoneyz/fg/hhbserr"  :showofg="true"></dxtable>
        </div>

    </div>
</template>
<script lang='ts' setup>
import dxtable from "./../../components/util/dxtable.vue";
import sort from "../../components/util/sort.vue";
import { NButton } from "naive-ui";
import { h, ref, reactive } from "vue";
import { dxget, prefixS, download, callBack, dxpost, qurl } from "../../util/index";
const showModal = ref(false)
const initeer = () => {
    databale.value.initDataExpose();
};

const iframeUrl = ref()
const databale = ref();
// 弹窗公用该列表    search: true, // 是否在搜索栏展示
let dataJson = reactive([
    {
        title: "公司名称(购)",
        key: "name",

    },
    {
        title: "税号(购)",
        key: "dutyParagraph",
    },
    {
        title: "发票号码",
        key: "invoiceNumber",

    },
    {
        title: "发票号码",
        key: "invoiceNumber",

    }, {
        title: "开票日期",
        key: "invoiceDate",
        width: 110
    },
    {
        title: "公司名称(销)",
        key: "SellerCompany",
    },
    {
        title: "税号(销)",
        key: "SellerTaxNumber",
    },
    {
        title: "合计金额",
        key: "amountTotal",
        width: 70
    }, {
        title: "合计税额",
        key: "AggregateTax",
        width: 70
    }, {
        title: "开票人",
        key: "drawer",
        width: 70
    },
    {
        title: "排序",
        width: 60,
        render(row) {
            row.databaseName = "fInvoiceList";
            return h(sort, {
                row,
                onCallBack: () => {
                    initeer();
                },
            });
        },
    },
    {
        title: "创建时间",
        key: "addTime",
        width: "150",
        type: "daterange",
    },
]);
let portUrl = "fapiao/fInvoiceList";
const qx = {
    DeletePermissionID: "fInvoiceListdel", //删除
    EditPermissionIdentifier: "fInvoiceListbj", // 编辑
    NewPermissionIdentifier: "fInvoiceListxzxxx", // 新建
    ViewPermissionID: "fInvoiceListck", // 查看
};
let formJson = reactive([
    {
        title: "公司名称",
        key: "name",
        type: "input",
        span: 24,
        required: true, // 是否为必填
    }, {
        title: "税号",
        key: "dutyParagraph",
        type: "input",
        required: true, // 是否为必填
    },
    {
        title: "印章",
        key: "seal",
        type: "img",
        val: ""
    },
]);


const czFun = {
    fun: (row, loading) => {
        return [
            h(
                NButton,
                {
                    type: "info",
                    quaternary: true,

                    onClick: async (e) => {
                        if (row.pdfUrl) {
                            download(row.pdfUrl, row.fileName)
                            return
                        }
                        loading.value = true
                        const jhjse = encodeURIComponent(import.meta.env.VITE_APIURL + 'fapiao/invoice?id=' + row.id)
                        const pfds: any = await dxget("https://duxinggj.com/util/urlzpdf?url=" + jhjse)
                        loading.value = false
                        download(pfds.data, row.fileName)
                    },
                },
                "下载pdf"
            ),

        ];
    },
};

const headBtnw = ref([
    {
        name: "批量导入",
        jy: true,
        type: "default",
        clickFun: () => {

        },
    },
]);

</script>
<style scoped>
.iframeerrrfwewe {
    border: 0;
    width: 100%;
    height: 540px;
}
</style>



